Skip to content

All 3 compilers FAIL getfield: missing null check, protected access check, array check; L2 unsupported#556

Open
opencode-agent[bot] wants to merge 1 commit into
masterfrom
opencode/issue287-20260622040949
Open

All 3 compilers FAIL getfield: missing null check, protected access check, array check; L2 unsupported#556
opencode-agent[bot] wants to merge 1 commit into
masterfrom
opencode/issue287-20260622040949

Conversation

@opencode-agent

Copy link
Copy Markdown

Spec compliance report

Compiler Status Issues
l1a ❌ FAIL Missing null check (NullPointerException), missing protected field access check, missing array class check
l1b ❌ FAIL Missing null check (NullPointerException), missing protected field access check, missing array class check
l2 ❌ FAIL L2ByteCodeSupportChecker marks getfield as unsupported; GenericX86CodeGenerator implementation missing null check, protected field check, array class check, wide field support, and float field support

Details

l1a Implementation

  • Status: ❌ FAIL
  • Files: core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java:1865-1943, plus VirtualStack.java/ItemStack.java
  • Issues:
    1. Missing NullPointerException check (spec §getfield Runtime Exception): Lines 1878-1880 pop/load objectref but emit no null test before field access.
    2. Missing protected field access check (spec §getfield Description): No verification that protected field access follows subclass rules.
    3. Missing array class check (spec §getfield Description): No check preventing getfield on array objects.
    4. Float uses FPU stack (lines 1885-1888, 1918-1921): Category-1 on operand stack but FPU stack model may cause issues at basic block boundaries.
    5. Error message typo (line 1869-1870): "getfield called on static field" — same message incorrectly appears in visit_putfield at line 3744.

l1b Implementation

  • Status: ❌ FAIL
  • Files: core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java:2256-2338, plus VirtualStack.java/ItemStack.java
  • Issues:
    1. Missing NullPointerException check (lines 2273-2275): Same as l1a.
    2. Missing protected field access check: Same as l1a.
    3. Missing array class check: Same as l1a.
    4. Float uses FPU stack (lines 2280-2283, 2313-2316): Same as l1a.
    5. Error message typo (line 2264-2265): Same incorrect message appears in visit_putfield at line 4666.

l2 Implementation

  • Status: ❌ FAIL
  • Files: core/src/core/org/jnode/vm/x86/compiler/l2/L2ByteCodeSupportChecker.java:187-189, GenericX86CodeGenerator.java:5054-5285
  • Issues:
    1. L2ByteCodeSupportChecker marks getfield unsupported (lines 187-189): Throws UnsupportedOperationException, so L2 never compiles methods with getfield.
    2. GenericX86CodeGenerator missing NullPointerException check (lines 5067-5068): ref obtained but no null test before field access (lines 5086-5256).
    3. Missing protected field access check: No implementation.
    4. Missing array class check: No implementation.
    5. Wide field support missing (line 5283): Throws IllegalArgumentException() with TODO.
    6. Float field support missing (line 5074): Throws IllegalArgumentException() with TODO.
    7. Error message typo (line 5059-5060): Same "getfield called on static field" message.

JVM Spec References (Java SE 6)

Instruction: getfield (opcode 180 / 0xb4)
Operand Stack: ..., objectref → ..., value
Linking Exceptions: Field resolution errors per §5.4.3.2; IncompatibleClassChangeError if resolved field is static
Runtime Exception: NullPointerException if objectref is null
Notes: Class of objectref must not be an array; protected field access restricted to current class or subclass; cannot access array length field (use arraylength).

Closes #287

New%20session%20-%202026-06-22T04%3A09%3A48.689Z
opencode session  |  github run

…heck, array check; L2 unsupported

Co-authored-by: LSantha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JVM instruction spec compliance: getfield

0 participants